package com.xczhang.economize;


import android.os.Bundle;
import android.app.Activity;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.Menu;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity extends Activity {
	EditText passwordtxt;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		passwordtxt=(EditText) this.findViewById(R.id.passwordtxt);
		
		passwordtxt.addTextChangedListener(new TextWatcher() {           
		    @Override
		    public void onTextChanged(CharSequence s, int start, int before, int count) {
		    	String txt=passwordtxt.getText().toString();
		    	if(txt.equals("qwer")){
		    		MainActivity.this.setContentView(R.layout.overview);
		    	}
		    	Toast.makeText(MainActivity.this, txt,Toast.LENGTH_LONG).show();
		    }
		     
		    @Override
		        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
		    }
		     
		    @Override
		        public void afterTextChanged(Editable s) {
		    }
		});
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true;
	}

}
